#pragma once
#include <iostream>
using namespace std;


class task
{
  private:
    int _x;
    int _y;
    char _op;
  public:
    task(int x = 0 , int y = 0 , char op = 0)
      :_x(x),
      _y(y),
      _op(op)
    {}
    ~task()
    {}
   public:
    void run()
    {
      int result = 0;
      switch(_op)
      {
        case '+':
          result = _x + _y;
          break;
        case '-':
          result = _x - _y;
          break;
        case '/':
          if (_y == 0)
          {
            cout << "DIV ERROR" << endl ;
            return;
          }
          result = _x / _y;          
          break;
        case '*': 
          result = _x * _y;
          break;
        case '%':
          result = _x % _y;
          break;
        default:
          cout << "unknown error" << endl;  
          return;
      }
      cout << "thread[" << pthread_self() << "]:" << _x << _op << _y << "=" << result << endl;
    }
};
